/**
 * 
 */
package ccrClasses.layer1.problems;

import ccrClasses.ICcr;
import ccrClasses.layer2.DateTime;
import ccrClasses.layer2.Description;
import ccrClasses.layer2.Source;
import ccrClasses.layer2.Status;

/**
 * @author matheus
 *
 */
public class Problem implements ICcr{
	
	public static final String OPEN_TAG = "<Problem>";

	public static final String CLOSE_TAG = "</Problem>";
	
	private DateTime startDateTime;
	
	private DateTime stopDateTime;
	
	private Description description;
	
	private Status status;
	
	private Source source;
	
	
	
	public Problem() {
		super();
	}

	public Problem(DateTime startDateTime, DateTime stopDateTime,
			Description description, Status status, Source source) {
		super();
		this.startDateTime = startDateTime;
		this.stopDateTime = stopDateTime;
		this.description = description;
		this.status = status;
		this.source = source;
	}

	public Problem(DateTime startDateTime,Description description, 
			Status status, Source source) {
		super();
		this.startDateTime = startDateTime;		
		this.description = description;
		this.status = status;
		this.source = source;
	}

	@Override
	public String constructCcrString() {
		String ccrAlert = OPEN_TAG;
		
		if (this.startDateTime != null) {
			ccrAlert = ccrAlert + this.startDateTime.constructCcrString();
		}

		if (this.stopDateTime != null) {
			ccrAlert = ccrAlert + this.stopDateTime.constructCcrString();
		}		
		
		if (this.description != null) {
			ccrAlert = ccrAlert + this.description.constructCcrString();
		}

		if (this.status != null) {
			ccrAlert = ccrAlert + this.status.constructCcrString();
		}

		if (this.source != null) {
			ccrAlert = ccrAlert + this.source.constructCcrString();
		}	
			
		ccrAlert = ccrAlert + CLOSE_TAG;
		
		return ccrAlert;
	}

	/**
	 * @return the startDateTime
	 */
	public DateTime getStartDateTime() {
		return startDateTime;
	}

	/**
	 * @param startDateTime the startDateTime to set
	 */
	public void setStartDateTime(DateTime startDateTime) {
		this.startDateTime = startDateTime;
	}

	/**
	 * @return the stopDateTime
	 */
	public DateTime getStopDateTime() {
		return stopDateTime;
	}

	/**
	 * @param stopDateTime the stopDateTime to set
	 */
	public void setStopDateTime(DateTime stopDateTime) {
		this.stopDateTime = stopDateTime;
	}

	/**
	 * @return the description
	 */
	public Description getDescription() {
		return description;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(Description description) {
		this.description = description;
	}

	/**
	 * @return the status
	 */
	public Status getStatus() {
		return status;
	}

	/**
	 * @param status the status to set
	 */
	public void setStatus(Status status) {
		this.status = status;
	}

	/**
	 * @return the source
	 */
	public Source getSource() {
		return source;
	}

	/**
	 * @param source the source to set
	 */
	public void setSource(Source source) {
		this.source = source;
	}
	
	
}
